package week_three_day03.jackson;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Date;

import com.fasterxml.jackson.databind.ObjectMapper;

public class JacksonTest {
	public static void main(String[] args) throws Exception{
		Customer c = new Customer(2,"evan",45.33,new Date());
		Address addr = new Address(23,"nash");
		c.setAddress(addr);
		addr.setC(c);
		ObjectMapper mapper = new ObjectMapper();
		mapper.writeValue(new FileOutputStream("customer.json"), c);
//		mapper.writeValue(System.out, addr);
		
		Customer customer = mapper.readValue(new FileInputStream("customer.json"), Customer.class);
		System.out.println(customer);
	}
}
